Implement moveCursorToPageUp/Down and bind PageUp/PageDown to them - #124
Merged
Conversation
Both methods were empty stubs marked `// TODO`, and neither `PageUp` nor `PageDown` was bound to anything in the default activators — on any platform. Pressing either key did nothing at all. The page is measured from the viewport: as many lines as fit on screen, less one kept as an overlap so that the reader can connect what was on screen with what is there now. When nothing is laid out yet there is no page to measure, and the cursor moves by a single line instead of standing still. With word wrap on a wrapped line still counts as one, so the jump may be longer than a screen; moving by visual lines would need the target line to be laid out, which it is not once it leaves the viewport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
moveCursorToPageUpandmoveCursorToPageDownare empty stubs marked// TODO, and neitherPageUpnorPageDownis bound to anything in thedefault activators — on any platform. Pressing either key does nothing at all.
The change
lines as fit on screen, less one kept as an overlap so that the reader can
connect what was on screen with what is there now.
by a single line rather than standing still.
PageUpandPageDownare added to both default activator maps, next to theexisting
cursorMovePageStart/cursorMovePageEndbindings.Notes
With word wrap on, a wrapped line still counts as one, so the jump may be longer
than a screen. Moving by visual lines would need the target line to be laid out,
and it is not once it leaves the viewport —
getDownPositionreturns null there.Happy to take a different approach if you prefer visual lines.
Found while building a file manager on
re_editor.Part of a small series from the same project: #122, #123, #125.